<?php
try {
    $dbh=new PDO('mysql:dbname=testbookstore;host=localhost','root','root');
} catch (PDOException $e) {
    echo '数据库连接失败：' . $e->getMessage();
    exit;
}
$query = "UPDATE contactInfo SET phone='15801656566' where name='高某某'";
$affected = $dbh->exec($query);
if ($affected) {
    echo '数据表contactInfo中受影响的行数为：' . $affected . "\r\n";
    echo 'lastInsertId：' . $dbh->lastInsertId("uid") . "\r\n";
} else {
    print_r($dbh->errorInfo());
}
?>

